package com.yc.d0316;

import com.google.gson.Gson;
import com.yc.bean.Result;
import com.yc.d0316.biz.BookBiz;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "RemoveBookServlet", value = "/RemoveBookServlet.s")
public class RemoveBookServlet extends HttpServlet {

    private BookBiz biz = new BookBiz();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        final String id = request.getParameter("id");
        final String flag = request.getParameter("flag");
        if ("逻辑删除".equals(flag)){
            biz.remove1(id);
        }else{
            biz.remove1(id);
        }
        final String s = new Gson().toJson(new Result(1,"删除成功",null));
        response.getWriter().append(s);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
